﻿<Pages:AudioBasePage xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
                     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                     xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                     xmlns:ec="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"
                     xmlns:Pages="clr-namespace:WindowsPhoneAudioStreaming.SampleApplication.Pages"
                     x:Class="WindowsPhoneAudioStreaming.SampleApplication.Pages.PodcastDetail.PodcastDetail"
                     Style="{StaticResource TransitionPageStyle}"
                     DataContext="{Binding PodcastDetail, Source={StaticResource Locator}}"
                     mc:Ignorable="d"
                     d:DesignHeight="768"
                     d:DesignWidth="480">
    <Grid x:Name="LayoutRoot"
          d:DataContext="{d:DesignData /SampleData/PodcastDetailPageSampleData/PodcastDetailPageSampleData.xaml}"
          Background="Transparent">
        <!--Pivot Control-->
        <controls:Pivot MinHeight="50"
                        
                        Foreground="{StaticResource BrandColour1Brush}">
            <!--Pivot item one-->
            <controls:Pivot.Title>
                <StackPanel Orientation="Vertical">
                    <TextBlock 
					DataContext="{StaticResource StationName}"
					Text="{Binding ConverterParameter=upper, Converter={StaticResource CaseConverter}}"
                               Foreground="{StaticResource BrandColour1Brush}">
                    </TextBlock>
                    <TextBlock Text="{Binding CurrentProgram.ProgramName}"
                               Opacity="0.66"
                               Foreground="{StaticResource PhoneForegroundBrush}" />
                </StackPanel>
            </controls:Pivot.Title>
            <controls:PivotItem Header="info"
                                DataContext="{Binding CurrentProgram}">
                <Grid>
                    <ScrollViewer ScrollViewer.VerticalScrollBarVisibility="Visible">
                        <StackPanel VerticalAlignment="Top"
                                    Width="456">
                            <TextBlock HorizontalAlignment="Left"
                                       TextWrapping="Wrap"
                                       Text="{Binding ProgramName, ConverterParameter=upper, Converter={StaticResource CaseConverter}}"
                                       Style="{StaticResource PhoneTextTitle2Style}"
                                       Margin="12,0,0,0">
                            </TextBlock>
                            <TextBlock TextWrapping="Wrap"
                                       Text="{Binding Description}"
                                       Style="{StaticResource PhoneTextNormalStyle}"
                                       Margin="12,0,12,24" />
                            <Image Source="{Binding ProgramImage}"
                                   VerticalAlignment="Top"
                                   Margin="12,0" />
                        </StackPanel>
                    </ScrollViewer>
                </Grid>
            </controls:PivotItem>

            <controls:PivotItem Header="podcasts"
                                DataContext="{Binding CurrentProgram}">
                <Grid Margin="12,0">
                    <ListBox x:Name="lbPodcasts"
                             ItemsSource="{Binding Podcasts}"
                             Margin="0"
                             HorizontalAlignment="Left"
                             VerticalAlignment="Top"
                             ItemsPanel="{StaticResource ListItemsPanelTemplate}"
                             ItemContainerStyle="{StaticResource ListBoxItemContainerStyle}">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="SelectionChanged">
                                <ec:CallMethodAction  MethodName="AddSelectedItemToPlaylist" />
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel>
                                    <Grid Margin="0,0,0,18"
                                          Background="{StaticResource BrandColour1Brush}">
                                        <TextBlock TextWrapping="Wrap"
                                                   Text="{Binding Date}"
                                                   Style="{StaticResource PhoneTextNormalStyle}"
                                                   Foreground="White"
                                                   Margin="0,0,12,0"
                                                   HorizontalAlignment="Right"
                                                   VerticalAlignment="Top" />
                                        <Image Source="{Binding ProgramImage}"
                                               Height="170"
                                               VerticalAlignment="Top"
                                               Width="170"
                                               HorizontalAlignment="Left"
                                               d:LayoutOverrides="Width, HorizontalMargin" />
                                        <Grid VerticalAlignment="Bottom"
                                              Margin="0,32,0,0">
                                            <Border Opacity="0.5"
                                                    Margin="0"
                                                    Background="Black" />
                                            <StackPanel Margin="12,6"
                                                        Orientation="Vertical"
                                                        d:LayoutOverrides="Height">
                                                <TextBlock TextWrapping="Wrap"
                                                           Text="{Binding Title, ConverterParameter=upper, Converter={StaticResource CaseConverter}}"
                                                           Style="{StaticResource PhoneTextTitle2Style}"
                                                           Margin="0"
                                                           TextAlignment="Right"
                                                           Foreground="White"
                                                           VerticalAlignment="Top"
                                                           HorizontalAlignment="Right"
                                                           FontFamily="Segoe WP" />
                                                <TextBlock TextWrapping="Wrap"
                                                           Text="{Binding Description}"
                                                           Style="{StaticResource PhoneTextNormalStyle}"
                                                           Margin="0"
                                                           Foreground="#DEFFFFFF"
                                                           FontSize="{StaticResource PhoneFontSizeMedium}"
                                                           TextAlignment="Right" />
                                                <TextBlock Text="tap to add to playlist"
                                                           Style="{StaticResource PhoneTextNormalStyle}"
                                                           Margin="0"
                                                           Foreground="#DEFFFFFF"
                                                           FontSize="{StaticResource PhoneFontSizeSmall}"
                                                           TextAlignment="Right"
                                                           TextDecorations="Underline" />
                                            </StackPanel>
                                        </Grid>
                                    </Grid>
                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Grid>
            </controls:PivotItem>
        </controls:Pivot>
    </Grid>

</Pages:AudioBasePage>
